package com.yunao.dao;

import com.yunao.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

public interface UserRepsitory extends JpaRepository<User,Integer> {

    List<User> findByOrganId(Integer organId);

    User findByUsername(String userName);

    @Transactional
    @Modifying
    @Query(value="update user set openid = ?1 where user_id = ?2",nativeQuery = true)
    void updateOpenidByUserId(String openid, String id);
}
